import requests

# 请求时携带认证
r = requests.get('http://127.0.0.1:8000/auth/',
                 params={
                     'username': 'admin',
                     'password': '123456'
                 })
print(r.text)

# 上传时携带认证后的cookies
f = requests.post('http://127.0.0.1:8000/upload/',
                  files={'file': open('lizhi.txt', 'rb'), 'file1': open('readme.md', 'rb')},
                  cookies=r.cookies)
f.raise_for_status()
print(f.text)
